var beiMiCommon = require("BeiMiCommon");
cc.Class({
    extends: beiMiCommon,
    properties: {
        // atlas: {
        //     default: null,
        //     type: cc.SpriteAtlas
        // },
        clubName:{
            default:null ,
            type : cc.Label
        },
        clubId:{
            default:null ,
            type : cc.Label
        },
        realId:{
            default:null ,
            type : cc.Label
        },
        backItem:{
            default:null ,
            type : cc.Node
        },
        // optiongroup:{
        //     default:null ,
        //     type : cc.Prefab
        // }
    },

    // use this for initialization
    onLoad: function () {
        //this.realId.active = false;
        //this.idNode = this.node.getChildByName("id");
    },
    clubClick: function(e){
        var idString = e.currentTarget.getChildByName("id").getComponent(cc.Label).string;
        var id = idString.split(" ")[1];
        var obj = {
            name: e.currentTarget.getChildByName("name").getComponent(cc.Label).string,
            id: id,
            realId: e.currentTarget.getChildByName("realId").getComponent(cc.Label).string
        }
        var thisEvent = new cc.Event.EventCustom("clubClick", true);
        thisEvent.setUserData(obj);
        this.node.dispatchEvent(thisEvent);
    },
    init:function(club, curClubId){
        this.curClubId = curClubId;
        this.clubName.string = club.clubname || "俱乐部名称";
        this.clubId.string = "ID "+club.showid;
        this.realId.string = club.clubid;
        this.realId.active = false;
        if(club.id==curClubId){
            this.backItem.active = true;
        }
        else{
            this.backItem.active = false;
        }
    }
});
